-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to plan based on chunk table AM #7284
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7284 +/- ##
===========================================
+ Coverage 80.06% 92.23% +12.17%
===========================================
Files 190 205 +15
Lines 37181 38471 +1290
Branches 9450 9977 +527
===========================================
+ Hits 29770 35485 +5715
+ Misses 2997 2983 -14
+ Partials 4414 3 -4411 ☔ View full report in Codecov by Sentry. |
I think we can merge much more parts of the TAM planning in this PR in the following way:
This way we can actually test the place where I saw the regression in this PR, which was my original motivation to suggest splitting it. And also remove much more changes from the TAM PR. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward. See no problems with this, it should only improve the situation, so approving, but I wonder if it makes any difference at all.
Potential risk is that the cache is invalidated during execution of the query, but this should not happen since it would require at least a ShareUpdateExclusiveLock
, so should be properly serialized.
The safest is to use the PostgreSQL cache each time, which does the right thing regardless of situation, at the risk of wasting some cycles if you fetch the chunk frequently. However, chunk look-ups should not be frequent, so this should not be a big problem, so I wonder if this commit makes any difference at all for anything but very specific benchmarks with cold caches.
3c4aef4
to
74fb72c
Compare
Of course it makes a difference, the reason we're doing this is that I found a 4% regression on a particular query. In general, the hypertable expansion is one of the most performance critical areas we have, so your intuition that an extra catalog lookup there costs nothing is wrong. We've spend a lot of effort on optimizing it in every possible way, including reducing the catalog lookups, and before that a random |
6242428
to
3bd5ba9
Compare
I added the planner hook code, and also did some refactoring there because the checks got a little unwieldy. Let me know what you think. I don't think it should hurt anything performance wise but we'll check with tsbench. I am not too fond of having unused skeleton code without anything that is there to use it. But the code is there now anyway so we can assess any impact as you wished. |
3bd5ba9
to
498b721
Compare
It would be interesting to understand what query that is and the variance in execution time for that query.
Hypertable expansion is done just once for each query, so this makes me wonder what kind of query you are running? How many catalog lookups are done for the query? Do you have a lot of chunks in the query? What is the execution time of the query?
As I said in the review, I see no problems in merging this since I think it is at best an improvement of execution time and at worst makes no difference. Not sure what you're objecting to here. |
498b721
to
31ae80f
Compare
31ae80f
to
505feb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, I've redone the benchmark manually and now the performance is the same as on main branch (ordered append planning suite, e.g. SELECT * FROM ht_chunk_1k ORDER BY time DESC LIMIT 1;
)
A chunk can use different table access methods so to support this more easily, cache the AM oid in the chunk struct. This allows identifying the access method quickly at, e.g., planning time.
505feb0
to
069bd67
Compare
Ok, that's good. @akuzm FYI, I did a small additional change to |
A chunk can use different table access methods so to support this more easily, cache the AM oid in the chunk struct. This allows identifying the access method quickly at, e.g., planning time.
Disable-check: force-changelog-file